package com.kikyou.api;


import com.kikyou.pojo.Category;
import com.kikyou.pojo.RespBean;
import com.kikyou.pojo.RespPageBean;
import com.kikyou.service.ICategoryService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Auther: 小胡
 * @Date: 2022/3/7:19:17
 * @Description: 职位类别
 */

@RestController
@RequestMapping("/organization/type")
public class CategoryController {

    @Autowired
    ICategoryService iCategoryService;

    @ApiOperation(value = "分页查询所有职位类别")
    @PostMapping("/{currentPage}/{pageSize}")
    public RespPageBean findPageCategory(@PathVariable("currentPage") int currentPage, @PathVariable("pageSize") int pageSize){
        return iCategoryService.findPageCategory(currentPage,pageSize);
    }

    @ApiOperation(value = "增加职位类别")
    @PostMapping("/addCategory")
    public RespBean addCategory(@RequestBody Category category){
        return iCategoryService.addCategory(category);
    }

    @ApiOperation(value = "修改职位类别")
    @PostMapping("/updateCategory")
    public RespBean updateCategory(@RequestBody Category category){
        return iCategoryService.updateCategory(category);
    }

    @ApiOperation(value = "删除职位类别")
    @DeleteMapping("/deleteCategory/{id}")
    public RespBean deleteCategory(@PathVariable("id") int id){
        return iCategoryService.deleteCategory(id);
    }

}
